home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / module-init-tools < prev    next >
Encoding:
Text File  |  2012-01-22  |  1.3 KB  |  65 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          module-init-tools
  4. # Required-Start:    
  5. # Required-Stop:     
  6. # Should-Start:      checkroot
  7. # Should-Stop:
  8. # Default-Start:     S
  9. # Default-Stop:
  10. # Short-Description: Process /etc/modules.
  11. # Description:       Load the modules listed in /etc/modules.
  12. ### END INIT INFO
  13.  
  14. # Silently exit if the kernel does not support modules.
  15. [ -f /proc/modules ] || exit 0
  16. [ -x /sbin/modprobe  ] || exit 0
  17.  
  18. [ -f /etc/default/rcS ] && . /etc/default/rcS
  19. . /lib/lsb/init-functions
  20.  
  21. PATH="/sbin:/bin"
  22.  
  23. KVER=$(uname -r)
  24. KMAJ=${KVER%${KVER#*.*[!.]}}
  25. KMAJ=${KMAJ%.}
  26.  
  27. if [ -e /etc/modules-$KVER ]; then
  28.   MODULES_FILE=/etc/modules-$KVER
  29. elif [ -e /etc/modules-$KMAJ ]; then
  30.   MODULES_FILE=/etc/modules-$KMAJ
  31. else
  32.   MODULES_FILE=/etc/modules
  33. fi
  34.  
  35. load_module() {
  36.   local module args
  37.   module="$1"
  38.   args="$2"
  39.  
  40.   if [ "$VERBOSE" != no ]; then
  41.     log_action_msg "Loading kernel module $module"
  42.     modprobe $module $args || true
  43.   else
  44.     modprobe $module $args > /dev/null 2>&1 || true
  45.   fi
  46. }
  47.  
  48. if [ "$VERBOSE" = no ]; then
  49.   log_action_begin_msg 'Loading kernel modules'
  50. fi
  51.  
  52. # Loop over every line in /etc/modules.
  53. grep '^[^#]' $MODULES_FILE | \
  54. while read module args; do
  55.   [ "$module" ] || continue
  56.   load_module "$module" "$args"
  57. done
  58.  
  59. if [ "$VERBOSE" = no ]; then
  60.   log_action_end_msg 0
  61. fi
  62.  
  63. exit 0
  64.  
  65.